var mongoose = require('mongoose')
mongoose.connect('mongodb://localhost/blog', { useNewUrlParser: true, useUnifiedTopology: true })
var Scheam = mongoose.Schema

var topicScheam = new Scheam({
    userId:{
        type: String,
        required: true
    },
    type:{
        type: String,
        required: true
    },
    title:{
        type: String,
        required: true
    },
    article:{
        type: String,
        required: true
    },
    create_time:{
        type: Date,
        default: Date.now
    }
})

module.exports = mongoose.model('Topic', topicScheam)